# Makefile for TCP server and client

# 编译器和编译选项
CXX = g++
CXXFLAGS = -std=c++11 -Wall

# 源文件
SRCS_SERVER = server.cpp
SRCS_CLIENT = client.cpp

# 输出文件
TARGET_SERVER = server
TARGET_CLIENT = client

# 默认目标
all: $(TARGET_SERVER) $(TARGET_CLIENT)

# 编译 TCP 服务端
$(TARGET_SERVER): $(SRCS_SERVER)
	$(CXX) $(CXXFLAGS) -o $(TARGET_SERVER) $(SRCS_SERVER)

# 编译 TCP 客户端
$(TARGET_CLIENT): $(SRCS_CLIENT)
	$(CXX) $(CXXFLAGS) -o $(TARGET_CLIENT) $(SRCS_CLIENT)

# 清理编译生成的文件
clean:
	rm -f $(TARGET_SERVER) $(TARGET_CLIENT)

# 安装目标
install:
	cp $(TARGET_SERVER) /usr/local/bin/
	cp $(TARGET_CLIENT) /usr/local/bin/

# 伪目标
.PHONY: all clean install
